package com.css.zfzx.sjcj.modules.hddcwyFaultSvyPoint.service.impl;

import cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult;
import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler;
import com.css.bpm.platform.utils.PlatformObjectUtils;
import com.css.zfzx.sjcj.common.excel.util.ActiveFaultEasyExcelVerifyHelper;
import com.css.zfzx.sjcj.modules.hddcwyFaultSvyPoint.viewobjects.HddcWyFaultsvypointVO;
import org.springframework.stereotype.Component;

/**
 * <p>断层观测点-点 Excel导入校验</p>
 *
 * @author liuhy
 * @date 2021/8/24
 */
@Component
public class FaultObservationPointExcelVerifyHandler implements IExcelVerifyHandler<HddcWyFaultsvypointVO> {

    private final ActiveFaultEasyExcelVerifyHelper helper;

    public FaultObservationPointExcelVerifyHandler(ActiveFaultEasyExcelVerifyHelper helper) {
        this.helper = helper;
    }

    @Override
    public ExcelVerifyHandlerResult verifyHandler(HddcWyFaultsvypointVO vo) {
        ExcelVerifyHandlerResult result = helper.verify(vo);
        if (PlatformObjectUtils.isEmpty(vo.getTargetfaultname())) {
            result.setSuccess(false);
            result.setMsg("目标断层名称 不能为空");
            return result;
        } else if (PlatformObjectUtils.isEmpty(vo.getTargetfaultsource())) {
            result.setSuccess(false);
            result.setMsg("目标断层来源 不能为空");
            return result;
        }
        return result;
    }

}
